using UnityEngine;
using UnityEngine.EventSystems;

namespace CardGameObject.GameScene
{
    public class GameMonsterPosition : MonoBehaviour
    {
        public SpriteRenderer CardBorder;

        public GameManager GameCardManager { get; set; }

        public bool IsUsed { get; set; }

        private void Start()
        {
            GameCardManager = GameManager.GetInstance();
            IsUsed = false;
        }

        private void OnMouseDown()
        {
            if (EventSystem.current.IsPointerOverGameObject())
            {
                return;
            }
            GameCardManager.CurSummonPosition = this.gameObject;
            GameCardManager.DoSummon();
        }

        /// <summary>
        /// 设置边框颜色为绿色并显示边框
        /// </summary>
        public void SetSummonableBorder()
        {
            Color greenColor = Color.green;
            greenColor.a = 1f; // 设置透明度为完全不透明
            CardBorder.color = greenColor;
        }

        /// <summary>
        /// 设置边框颜色为红色并显示边框
        /// </summary>
        public void SetAttackableBorder()
        {
            Color redColor = Color.red;
            redColor.a = 1f; // 设置透明度为完全不透明
            CardBorder.color = redColor;
        }

        /// <summary>
        /// 设置边框透明，使其不再显示
        /// </summary>
        public void SetBorderTransparent()
        {
            Color transparentColor = CardBorder.color;
            transparentColor.a = 0f; // 设置透明度为完全透明
            CardBorder.color = transparentColor;
        }
    }
}
